#pragma once

#include "stdafx.h"
#include "bbAddon.h"

typedef unsigned char uchar;
typedef uchar * achar;

const int TobbObject_old(void*obj) {return rcast_i(obj);};




void _pokeint_(achar a, int o, int v)		{a[o]=(v>>24)&0xff;a[o+1]=(v>>16)&0xff;a[o+2]=(v>>8)&0xff;a[o+3]=v&0xff;};
void _pokefloat_(achar a, int o, float f)	{achar ptr = (achar)&f;a[o]=ptr[0]; a[o+1]=ptr[1]; a[o+2]=ptr[2]; a[o+3]=ptr[3];};

int _peekint_(achar a, int o)				{return (((a[o])<<24)+((a[o+1])<<16)+((a[o+2])<<8)+(a[o+3]));};
float _peekfloat_( achar a, int o )			{float val; achar ptr = (achar)&val;ptr[0]=a[o]; ptr[1]=a[o+1]; ptr[2]=a[o+2]; ptr[3]=a[o+3];return val;};

int _ArraySize_( achar A )					{return (((A[0])<<24)+((A[1])<<16)+((A[2])<<8)+(A[3]));};


float Str2Float(const std::string &in)
{
/*    std::ostringstream o;
	o<<in;
	float f;
	o >> f;
	return f;
	*/
	return 0.0f;
}

const char* FloatToCChar(float val)
{
	char* str = new char[10];
	sprintf_s(str, 10, "%.8g", val);
	return str;
};
